<template>
  <div class="itemWrapper">
    <div class="mediaBox" @click="routerInfo">
      <img v-if="detail.resType === 'image'" :src="detail.resURL">
      <img v-else :src="detail.cover">
      <!--<span v-else-if="detail.resType === 'video'">-->
      <!--<i class="icon-video iconfont" />-->
      <!--</span>-->
      <!--<span v-else-if="detail.resType === 'zip'">-->
      <!--<i class="icon-zip iconfont" />-->
      <!--</span>-->
      <!--<span v-else>-->
      <!--<i class="icon-word iconfont" />-->
      <!--</span>-->
    </div>
    <div class="detail">
      <p class="flex-line split">
        <span class="flex-30">
          {{ detail.staffName }}
        </span>
        <span class="flex-30">
          {{ detail.visitorCount?detail.visitorCount:0 }}人 <i class="mr5 el-icon-user" />
        </span>
        <span class="flex-30">
          {{ detail.created | dateFilter('YYYY/MM/DD') }}
        </span>
      </p>
      <h3 class="pt-10 flex-line center">
        {{ detail.title }}
      </h3>
      <!-- <p class="con">{{ detail.description }}</p> -->
    </div>
    <div class="gradientBtn tag ">
      {{ detail.dirTitle }}
    </div>
  </div>
</template>
<script>
export default {
  props: {
    detail: {
      type: Object,
      default: () => ({})
    },
    isMy: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    routerInfo () {
      // /educational/courseManage/source/info
      // /teacherResource/training/source/info
      this.$router.push({
        path: '/teacherResource/training/source/info',
        query: {
          id: this.detail.id
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.itemWrapper {
  position: relative;
  margin-bottom: 30px;
  cursor: pointer;

  .mediaBox {
    position: relative;
    height: 230px;
    background: #fafafa;

    > img {
      width: 100%;
      height: 100%;
    }

    > span {
      position: absolute;
      display: block;
      left: 50%;
      top: 50%;
      z-index: 8;
      transform: translate(-50%, -50%);
      text-align: center;

      i {
        font-size: 56px;
        color: #69b7df;
      }
    }
  }

  .detail {
    margin-top: 20px;

    h3 {
      font-size: 17px;
      font-family: PingFang SC;
      font-weight: bold;
      color: #333333;
      line-height: 1;
      margin-top: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-bottom: 0px;
    }

    p {
      font-size: 13px;
      font-family: PingFang SC;
      font-weight: 500;
      color: #999999;
      line-height: 1.5;
    }
    .con {
      height: 30px;
      line-height: 2;
      margin-top: 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }

  footer {
    margin-top: 10px;

    .gradientBtn {
      height: 40px;
    }
  }
}
.tag {
  position: absolute;
  z-index: 8;
  top: 10px;
  left: -10px;
  height: 30px;
  display: inline-block;
  padding: 0 24px;
  line-height: 30px;
  border-top-left-radius: 15px;
  border-bottom-right-radius: 15px;
  color: #fff;
  font-size: 13px;
  font-family: PingFang SC;
}
</style>
